package com.atguigu.gulimall.test.service;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.stereotype.Component;

@Component
public class UserService implements BeanNameAware {

    private String currentClassBeanName;

    @Override
    public void setBeanName(String s) {
        this.currentClassBeanName = s; // s 就表示UserService在容器中的bean的名字
        System.out.println(s);
    }

    public String getCurrentClassBeanName() {
        return currentClassBeanName;
    }

    public void setCurrentClassBeanName(String currentClassBeanName) {
        this.currentClassBeanName = currentClassBeanName;
    }
}
